<template>
	<view>
		<HeadCustom></HeadCustom>
		<u-tabs :list="yeaLlist" @click="chooseYear"></u-tabs>
		<view class="uni-container">
			<uni-table ref="table" :loading="loading" border emptyText="暂无更多数据"
				@selection-change="selectionChange">
				<uni-tr>
					<uni-th width="50" align="center">序号</uni-th>
					<uni-th width="50" align="center">初试成绩</uni-th>
					<uni-th width="100" align="center">一志愿学校</uni-th>
					<uni-th width="100" align="center">专业</uni-th>
					<uni-th width="50" align="center">科目一成绩</uni-th>
					<uni-th width="50" align="center">科目二成绩</uni-th>
					<uni-th width="50" align="center">科目三成绩</uni-th>
					<uni-th width="50" align="center">科目四成绩</uni-th>
					<uni-th width="50" align="center">姓名</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in studentList" :key="index">
					<uni-td>{{index + 1}}</uni-td>
					<uni-td>
						<view class="name">{{ item.cs }}</view>
					</uni-td>
					<uni-td align="center">{{ item.yzyxxmc }}</uni-td>
					<uni-td align="center">{{ item.zymc }}</uni-td>
					<uni-td align="center">{{ item.kmycj }}</uni-td>
					<uni-td align="center">{{ item.kmecj }}</uni-td>
					<uni-td align="center">{{ item.kmscj }}</uni-td>
					<uni-td align="center">{{ item.kmsicj }}</uni-td>
					<uni-td align="center">{{ item.xm }}</uni-td>
				</uni-tr>
			</uni-table>
			<view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize" :current="pageCurrent"
					:total="total" @change="change" /></view>
		</view>
	</view>
</template>

<script>
	import {
		getStudentList
	} from '@/utils/api.js'
	export default {
		onLoad(option) {
			// 1016565
			this.params.majorOutRelationId = option.majorOutRelationId 
			this.status = option.status
			this.schoolName = option.schoolName
			// this.params.majorOutRelationId = '1016565'
			this.getStudentList()
		},
		data() {
			return {
				searchVal: '',
				status:"",  // 1-调剂数据   2-录取数据
				schoolName:'',
				selectedYear:'2024',
				yeaLlist:[
					{
						name:'2024'
					},
					{
						name:'2023'
					},
					{
						name:'2022'
					},
				],
				params:{
					majorOutRelationId:'',
					ssnf:2024,
					pageNum:1,
					pageSize:20
				},
				tableData: [
					{createBy: null,
					createTime: null,
					cs: 411,
					fs: 90,
					id: 4361,
					kmecj: "-",
					kmscj: "-",
					kmsicj: "-",
					kmycj: "-",
					majorCode: "135700",
					majorList: null,
					majorName: "设计",
					majorOutRelationId: 1016565,
					oriXm: null,
					params: {},
					remark: null,
					searchValue: null,
					updateBy: null,
					updateTime: null,
					xm: "***",
					year: 2024,
					yjfxdm: "00",
					yzyxxdm: 10011,
					zcj: 84,
					zxjh: null,
					},
					{
						createBy: null,
						createTime: null,
						cs: 400,
						fs: 91,
						id: 4362,
						kmecj: "-",
						kmscj: "-",
						kmsicj: "-",
						kmycj: "-",
						majorCode: "135700",
						majorList: null,
						majorName: "设计",
						majorOutRelationId: 1016565,
						oriXm: null,
						params: {},
						remark: null,
						searchValue: null,
						updateBy: null,
						updateTime: null,
						xm: "***",
						year: 2024,
						yjfxdm: "00",
						yzyxxdm: 10011,
						zcj: 83,
						zxjh: null,
					}
				],
				// 每页数据量
				pageSize: 10,
				// 当前页
				pageCurrent: 1,
				// 数据总量
				total: 0,
				loading: false,
				studentList:[],
				rowData:[]
			}
		},
		methods:{
			async getStudentList() {
				
				uni.showLoading({
					title:'加载中'
				})
				let res = await getStudentList(this.params)
				if(res.code == 200) {
					this.rowData = res.rows
					this.filterData()
				}
				uni.hideLoading()
				console.log('this.rowData',this.rowData)
			},
			chooseYear(item) {
				this.params.ssnf = item.name
				this.getStudentList()
			},
			filterData() {
				if(this.status == 1) {
					this.studentList = this.rowData.filter((item,index) => {
						return item.yzyxxmc != this.schoolName 
					})
				}else {
					this.studentList = this.rowData
				}
			}
		}
	}
</script>

<style>
</style>